<?php

class Company_info  extends AdminManage
{

	/**
	 * 初始化
	 */
	public function _init()
	{

	}

	/**
	 * 默认动作
	 */
	protected function _default()
	{

		$id = $this->getParam('id','i');

		if($_SERVER["REQUEST_METHOD"] === "POST"  && $_POST['sub']==1 ){
			$data['title'] = $this->getParam('title','t');#
			$data['content'] = $this->getParam('info','t');#
			$data['dateline']  = time();
//			$data['checkState'] = 1;

			if($id>0){ //编辑

				$data['checkState'] = 1;
				if(DB::update("company_info",'id='.$id,$data)){
					$this->alertBack("保存成功！");
				}else{
					$this->alertBack("编辑失败,请重试！");
				}
			}else{
				if(DB::insert("company_info",$data)){
					$this->alertBack("保存成功！");
				}else{
					$this->alertBack("保存失败,请重试！");
				}

			}

		}//end 编辑发布提交表单


		if($id) {  //编辑
			$res = DB::select('select * from company_info where id ='.$id );



			$this->assign('data',$res[0]);
		}



		$this->assign('menu_navbar','企业介绍  -- <a href="'.$_GET['action'].'.html">企业介绍</a>');
		$this->tpl_full_path('/admins/company_info/add_form');




	}




}
?>
